package cn.honqun.tinycms.domain.vo;

import cn.honqun.tinycms.constants.RegexConstants;
import cn.honqun.tinycms.domain.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;

@Setter
@Getter
@Schema(title = "User", description = "用户VO")
public class UserVO extends User {
    @NotEmpty(message = "用户名是必须的")
    @Length(min = 5, max = 20, message = "用户名最长20字符，最少5字符")
    @Schema(description = "用户名")
    private String username;

    @NotEmpty(message = "手机号是必须的")
    @Pattern(regexp = RegexConstants.REGEX_PHONE_NUM, message = "请输入正确的手机号")
    @Schema(description = "手机号")
    private String phoneNum;

    @Schema(description = "角色ID, 可以根据角色查询")
    private Long roleId;
    /**
     * 登录Token
     */
    private String token;

    /**
     * token的名字
     */
    private String tokenName;
}
